<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="UTF-8">
		<title>红酒会 - 智能红酒管家</title>
		<link rel="shortcut icon" type="image/x-icon" href="${ctx}/favicon.ico" />
		<link rel="stylesheet" href="http://libs.baidu.com/bootstrap/2.3.2/css/bootstrap.min.css" />
		<link rel="stylesheet" href="http://libs.baidu.com/bootstrap/2.3.2/css/bootstrap-responsive.min.css" />
		<link rel="stylesheet" href="${ctx}/static/styles/style.css" />
	</head>
<body>
	
	<c:import url="/header"><c:param name="module">talk</c:param></c:import>
	
	<div class="container" id="container">
		<div class="row">
				
			<!-- 内容 -->
			<div class="span8">
				<div>
					<ul class="breadcrumb">
						<li><a href="${ctx}/talk">酒说说</a> <span class="divider">/</span></li>
	  					<li class="active">${tag.name}</li>
					</ul>
				</div>
				<div class="topic-list">
					<c:forEach var="list" items="${list}">
						<h4><a href="${ctx}/talk/detail/${list.id}" target="_blank">${list.title}</a></h4>
						<p class="gray">发布人：<a href="${ctx}/user/${list.editorId}" target="_blank">${list.editorName}</a>
							<span class="pull-right gray">
								<fmt:formatDate value="${list.editTime}" pattern="yyyy-MM-dd HH:mm"/></span></p>
						<c:choose>
							<c:when test="${not empty list.imageUrl}">
								<div class="left"><img src="${list.imageUrl}" style="height:100px;"></div>
								<div class="right">
									<p>${list.summary}
										<a href="${ctx}/talk/detail/${list.id}" target="_blank">[详细]</a></p>
									<c:if test="${not empty list.tags}">
										<span class="gray">标签：
											<c:set var="tags" value="${fn:split(list.tags, ';')}" />
											<c:forEach var="tag" items="${tags}">
												<a href="${ctx}/talk/tag/${fn:split(tag, ':')[0]}">
													<span class="label label-important">${fn:split(tag, ':')[1]}</span></a>&nbsp;
											</c:forEach>
										</span>
									</c:if>
									<span class="pull-right gray">评论：${list.commentCount}</span>
								</div>
								<div class="clear-float"></div>   
							</c:when>
							<c:otherwise>
								<p>${list.summary}
									<a href="${ctx}/talk/detail/${list.id}" target="_blank">[详细]</a></p>
								<c:if test="${not empty list.tags}">
									<span class="gray">标签：
										<c:set var="tags" value="${fn:split(list.tags, ';')}" />
										<c:forEach var="tag" items="${tags}">
											<a href="${ctx}/talk/tag/${fn:split(tag, ':')[0]}">
												<span class="label label-important">${fn:split(tag, ':')[1]}</span></a>&nbsp;&nbsp;
										</c:forEach>
									</span>
								</c:if>
								<span class="pull-right gray">评论：${list.commentCount}</span>
							</c:otherwise>
						</c:choose>
						<hr/>
					</c:forEach>
				</div>
				<div class="pagination pull-right">
				  	<ul>
				  		<c:choose>
				  			<c:when test="${paging.pageIndex == 0}">
				  				<li class="disabled"><span>首页</span></li>
				  				<li class="disabled"><span>上一页</span></li>
				  			</c:when>
				  			<c:otherwise>
				  				<li><a href="${ctx}/talk/tag/${query.tagId}?pageIndex=0">首页</a></li>
				  				<li><a href="${ctx}/talk/tag/${query.tagId}?pageIndex=${paging.pageIndex - 1}">上一页</a></li>
				  			</c:otherwise>
				  		</c:choose>
				  		<c:choose>
				  			<c:when test="${paging.pageIndex == paging.pageCount - 1}">
				  				<li class="disabled"><span>下一页</span></li>
				  				<li class="disabled"><span>尾页</span></li>
				  			</c:when>
				  			<c:otherwise>
				  				<li><a href="${ctx}/talk/tag/${query.tagId}?pageIndex=${paging.pageIndex + 1}">下一页</a></li>
				  				<li><a href="${ctx}/talk/tag/${query.tagId}?pageIndex=${paging.pageCount - 1}">尾页</a></li>
				  			</c:otherwise>
				  		</c:choose>
					</ul>
				</div>
			</div>
			
			<!-- 侧栏 -->
			<div class="span4">
				<c:import url="/talk/right"><c:param name="module">talk</c:param></c:import>
			</div>
			
		</div>
	</div>
</body>
</html>